package com.ruoyi.project.kbjz.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.ypjxc.domain.Drug;
import com.ruoyi.project.ypjxc.service.YpjxcDrugService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/kbjz/medicinelist")
public class KbjzMedicinelistController extends BaseController {
    @Autowired
    private YpjxcDrugService ypjxcDrugService;

    /**
     * 根据关键字查询药品信息
     * @param keyword 关键字
     * @return
     */
    @GetMapping("/selectDrugByKeyWord/{keyword}")
    public TableDataInfo selectDrugByKeyWord(@PathVariable String keyword){
        Drug drug = new Drug();
        drug.setDrugName(keyword);
        List<Drug> drugs = ypjxcDrugService.selectDrugList(drug);
        return getDataTable(drugs);
    }
}
